#ifndef SDINPUT_H
#define SDINPUT_H

#include "../src/chipmunk.h"

class sdInput {
    private:
        int width_;
        int height_;

        static sdInput* this_;

        int keyDown_[256];
        cpVect mouseLoc_;

        //Callback helpers
        void keyboard(unsigned char key, int x, int y);
        void keyboardUp(unsigned char key, int x, int y);
        void mouse(int x, int y);        

    public:
        //Construction
        sdInput(int width = 0, int height = 0);
        void init();

        //Instance Retreival
        static sdInput* getThis();

        //Possibly not needed
        inline int getHeight() {return height_;}
        inline int getWidth() {return width_;}

        //Input retreival
        cpVect getDirection();
        inline cpVect getMouse() {return mouseLoc_;}
        bool keyDown(int index);
        bool operator[](char key);



        //Callbacks
        inline static void keyboardCb(unsigned char key, int x, int y) {getThis()->keyboard(key, x, y);}
        inline static void keyboardUpCb(unsigned char key, int x, int y) {getThis()->keyboardUp(key, x, y);}
        inline static void mouseCb(int x, int y) {getThis()->mouse(x, y);}
};

#endif
